﻿using System;

namespace OpenCost.Common.Readings
{
    public class RealTimeReading:Reading
    {
        public float ch1;
        public float ch2;
        public float ch3;
        public float temp;
        public DateTime time;
        public int sensor;
        public int radioid;
        public int dsb;
        public string src;

        /// <summary>
        /// Used for comparing RealTimeReadings
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public static int CompareByTime(RealTimeReading x, RealTimeReading y)
        {
            if (x==null)
            {
                if (y==null)
                {
                    return 0;
                }
                return -1;
            }
            if (y==null)
            {
                return 1;
            }
            if (x.time>y.time)
            {
                return 1;
            }
            if ( x.time==y.time)
            {
                return 0;
            }
            return -1;
        }
    }
}
